<template>
<div v-cloak class="aui-wrapper aui-page__iframe">
		<div class="aui-content__wrapper">
			<div class="aui-content">
				<el-card shadow="never" class="aui-card--fill">
					<div class="mod-lswms__receiptdetaillist">
						<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
							<el-form-item>
								<el-input size="small" v-model="dataForm.sku" placeholder="物料编码" clearable></el-input>
							</el-form-item>
							<el-form-item>
								<el-input size="small" v-model="dataForm.descr" placeholder="物料名称" clearable></el-input>
							</el-form-item>
							<el-form-item>
								<el-button size="small" @click="getDataList()">查询</el-button>
							</el-form-item>
							<!-- <el-form-item>
                            <el-button type="primary" @click="addOrUpdateHandle()">新增</el-button>
                          </el-form-item> -->
							<!--<el-form-item>
                            <el-button type="danger" @click="deleteHandle()">删除</el-button>
                          </el-form-item>
                          <el-form-item>
                            <el-button type="info" @click="exportHandle()">导出</el-button>
                          </el-form-item>-->
						</el-form>
						<el-table v-loading="dataListLoading" :data="dataList" border style="width: 100%;">
							<el-table-column prop="sku" label="物料编码" header-align="center" align="center">
							</el-table-column>
							<el-table-column prop="descr" label="物料名称" header-align="center" align="center"></el-table-column>
							<el-table-column prop="safetyqty" label="安全数量" header-align="center" align="center">
							</el-table-column>
							<!-- <el-table-column prop="warningdays" label="提前预警天数" header-align="center" align="center">
							</el-table-column> -->
							<el-table-column prop="qty" label="当前数量" header-align="center" align="center">
							</el-table-column>
							
						</el-table>
					</div>
				</el-card>
			</div>
		</div>
	</div>

</template>

<script>
		import DataList from "@/utils/DataList";
		import {
			ref,
			reactive,
			onMounted,
			nextTick
		} from 'vue';
		import {getSafetyStock} from "@/network/lswms/statistics/statistics.js"
			import {hasPermission} from "@/utils/hasPermission"
			import {
				ElMessage,
				ElMessageBox
			} from 'element-plus'
    export default {
        name: "SafetyStock",
		setup() {
			// const {
			// 	dataForm,
			// 	mixinViewModuleOptions,
			// 	getDataList,
			// 	dataList,
			// 	total,
			// 	page,
			// 	limit,
			// 	dataListLoading,
			// 	dataListSelectionChangeHandle,
			// 	dataListSortChangeHandle,
			// 	pageSizeChangeHandle,
			// 	pageCurrentChangeHandle,
			// 	addOrUpdateHandle,
			// 	deleteHandle,
			// 	exportHandle,
			// 	addOrUpdateVisible,
			// 	dataListSelections,
			// 	addOrUpdate
			// } = DataList();
			const dataListLoading = ref(false);
			const dataForm = ref({}) // 查询条件
			const dataList = ref([]); // 数据列表
			
		
			onMounted(() => {
				// mixinViewModuleOptions.value.getDataListIsPage = true;
				// mixinViewModuleOptions.value.getDataListURL = '/lswms/statistics/getEarlyWarning';
				// mixinViewModuleOptions.value.deleteURL = '/lswms/recipients';
				// mixinViewModuleOptions.value.exportURL = '/lswms/recipients/export';
				// mixinViewModuleOptions.value.deleteIsBatchKey = 'id';
				// mixinViewModuleOptions.value.deleteIsBatch = true
				dataListLoading.value = true;
				getDataList();
				
			})
			const getDataList =()=>{
				getSafetyStock(dataForm.value).then((res)=>{
					if(res.code!=0){
						dataList.value  = [];
						return ElMessage.error(res.msg);
					}
					dataList.value = res.data
					dataListLoading.value = false;
				})
				
			}
		
			return {
				 dataForm,
				// mixinViewModuleOptions,
				 getDataList,
				 dataList,
				 dataListLoading
				// total,
				// page,
				// limit,
				// dataListLoading,
				// dataListSelectionChangeHandle,
				// dataListSortChangeHandle,
				// pageSizeChangeHandle,
				// pageCurrentChangeHandle,
				// addOrUpdateHandle,
				// deleteHandle,
				// exportHandle,
				// addOrUpdateVisible,
				// dataListSelections,
				// addOrUpdate
			}
		},
		methods:{
			hasPermission
		}
    }
</script>

<style scoped>

</style>
